package security

import (
	"sync"
)

// MalwareCount 结构体
type MalwareCount struct {
	// 高风险恶意代码数量
	HighLevel int64 `json:"high_level,omitempty" xml:"high_level,omitempty"`
	// 低风险恶意代码数量
	LowLevel int64 `json:"low_level,omitempty" xml:"low_level,omitempty"`
	// 恶意代码总数量
	Total int64 `json:"total,omitempty" xml:"total,omitempty"`
	// 若风险恶意代码数量
	WeakLevel int64 `json:"weak_level,omitempty" xml:"weak_level,omitempty"`
}

var poolMalwareCount = sync.Pool{
	New: func() any {
		return new(MalwareCount)
	},
}

// GetMalwareCount() 从对象池中获取MalwareCount
func GetMalwareCount() *MalwareCount {
	return poolMalwareCount.Get().(*MalwareCount)
}

// ReleaseMalwareCount 释放MalwareCount
func ReleaseMalwareCount(v *MalwareCount) {
	v.HighLevel = 0
	v.LowLevel = 0
	v.Total = 0
	v.WeakLevel = 0
	poolMalwareCount.Put(v)
}
